<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
	<META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=utf-8">
	<TITLE></TITLE>
	<META NAME="GENERATOR" CONTENT="OpenOffice.org 2.0  (Linux)">
	<META NAME="AUTHOR" CONTENT="kejin">
	<META NAME="CREATED" CONTENT="20061120;17150100">
	<META NAME="CHANGEDBY" CONTENT="kejin">
	<META NAME="CHANGED" CONTENT="20070918;23020500">
	<STYLE TYPE="text/css">
	<!--
		@page { size: 8.5in 11in; margin: 0.79in }
		P { margin-bottom: 0.08in }
		H2 { color: #000000 }
		H3 { color: #000000 }
		PRE { color: #000000 }
	-->
	</STYLE>
</HEAD>
<BODY LANG="en-US" DIR="LTR">
<H2>PocoCapsule/C++ example: WebServices Bigbank 
</H2>
<P>Copyright(c) 2006 by <A HREF="http://www.pocomatic.com/">Pocomatic
Software</A>. All rights reserved. 
</P>
<P>The bigbank example presented here is originated from the
<A HREF="http://www.osoa.org/display/Main/Service+Component+Architecture+Home">OASIS-OSCA
</A>example highlighted in official OASIS-OpenCSA <A HREF="http://www.osoa.org/download/attachments/28/SCA_BuildingYourFirstApplication_V09.pdf?version=1">document</A>
and its prove-of-concept <A HREF="http://cwiki.apache.org/confluence/display/TUSCANY/SCA+Native">prototype
implementation</A>. Here, this example is assembled using
POCO-WebServices assembly schema/model, that is not only more
intuitive, simpler and flexible but also powerful than
OASIS-OpenCSA's assembly model. The same bigbank example assembled
using OASIS-OpenCSA assembly model can be found in
<A HREF="../bigbank-ocsa/README.html">${POCOCAPSULE_DIR}/examples/web-services/bigbank-ocsa</A>.</P>
<P>In this example, the bigbank server exports one web service
(defined by <A HREF="AccountService.wsdl">AccountService.wsdl</A>),
uses one external service (defined by <A HREF="StockQuoteWebService.wsdl">StockQuoteWebService.wsdl</A>),
and consists the following three plain old C++ objects (POCO):</P>
<UL>
	<LI><P><FONT SIZE=2 STYLE="font-size: 11pt">AccountService: T<FONT SIZE=2 STYLE="font-size: 9pt">his
	component will be exported as a web service, therefore, its
	implementation class (AccountServiceComponentImpl) is extended from
	a SOAP skeleton (AccountServiesSOAPImpl) generated from WSDL.</FONT></FONT></P>
	<LI><P><FONT SIZE=2 STYLE="font-size: 11pt">AccountDataService: <FONT SIZE=2 STYLE="font-size: 9pt">This
	component is only referred within the composite and will not be
	exported as web service. Therefore, its implementation does not
	subclass from any virtual interface class.</FONT></FONT></P>
	<LI><P><FONT SIZE=2 STYLE="font-size: 11pt">StockQuoteService:
	<FONT SIZE=2 STYLE="font-size: 9pt">Similar, this component is also
	only referred within the composite and therefore does not subclass
	from any virtual interface class either.</FONT></FONT></P>
</UL>
<P>These POCO objects (components) are implemented in <A HREF="Components.h">Components.h</A>
and <A HREF="Components.C">Components.C</A>. Their dependency are
wired up by PocoCapsule Container through C++ setter operations of
their POCO classes. 
</P>
<H3><A HREF="bigbank-ws.jpg"><IMG SRC="bigbank-ws.jpg" NAME="BIGBANK-WS.JPG" ALIGN=LEFT WIDTH=758 HEIGHT=496 BORDER=0><BR CLEAR=LEFT></A>Source
Files</H3>
<P><A HREF="server.C">server.C:</A> This is a simple container, used
to setup and assemble the application. It is notable that this
container itself neither contains code, nor links with application
specific bean implementations.</P>
<P><A HREF="AccountService.wsdl">AccountService.wsdl</A>: The
definition of the web service provided by the bigbank server. 
</P>
<P><A HREF="StockQuoteWebService.wsdl">StockQuoteWebService.wsdl</A>:
The defintion of the web service provided by www.webserviceX.NET.
This web service is used by the StockQuoteServiceComponent of the
bigbank composite. 
</P>
<P><A HREF="Components.h">Components.h</A> and <A HREF="Components.C">Components.C</A>:
These files provide implementations (in form of plain old C++ object
classes) of the three components. 
</P>
<P><A HREF="setup.xml">setup.xml</A>: The main setup descriptors that
first loads the needed library (the one contains component
implementation classes), and then instantiates the web service engine
and wires (connects) the POCO objects. 
</P>
<P><A HREF="client.C">client.C</A>: The client application. 
</P>
<H3>Building this example</H3>
<P>To build this example, the environment variable POCOCAPSULE_DIR
should point to the PocoCapsule/C++ installed directory. Also, this
example assumes the <A HREF="http://www.systinet.com/products/ssc/overview">Systinet
server for C++</A> is installed and its runtime and development
environment (such as WASPC_HOME environment variable pointing to its
installation directory) are set properly according to its
specification. 
</P>
<P STYLE="font-weight: medium">Once the environment is set and
required Systinet server for C++ is installed and configured
accordingly, this example can be built by simply invoking gmake/make
on linux/unix or nmake on windows. 
</P>
<H3>Running this example</H3>
<P STYLE="margin-bottom: 0in"><FONT FACE="Symbol">&middot; </FONT><FONT FACE="Times New Roman">Before
starting the server, make sure the LD_LIBRARY_PATH (on linux and
solaris) or the PATH (on windows) environment variable is set
correctly to include the ${POCOCAPSULE_DIR}/lib directory and <FONT FACE="Times New Roman">the
${WASPC_HOME}/lib directory</FONT>.</FONT></P>
<P STYLE="margin-bottom: 0in"><FONT FACE="Symbol">&middot; </FONT><FONT FACE="Times New Roman">start
the bigbank AccountService server as: </FONT>
</P>
<PRE STYLE="margin-left: 0.79in; margin-bottom: 0.2in"><FONT FACE="Courier 10 Pitch"><B>prompt&gt;</B> server</FONT></PRE><P STYLE="margin-bottom: 0in">
<FONT FACE="Times New Roman">The, start the client:</FONT></P>
<PRE STYLE="margin-left: 0.79in; margin-bottom: 0.2in"><FONT FACE="Courier 10 Pitch"><B>prompt&gt;</B> client [server-URL]</FONT></PRE><P STYLE="margin-bottom: 0in">
<FONT FACE="Times New Roman">Here, the server URL is (optional, if
client is on localhost): http://&lt;server-address&gt;:6070/AccountService.</FONT></P>
<P STYLE="margin-bottom: 0in"><FONT FACE="Times New Roman">On
receiving client request, the server will contact the Web Serivces
site www.webserviceX.net and print out the following messages:</FONT></P>
<PRE STYLE="margin-left: 0.79in"><FONT FACE="DejaVu Sans Mono, monospace">GetQuote on www.webserviceX.net, pls wait ...</FONT>
<FONT FACE="DejaVu Sans Mono, monospace">Stock IBM last price is : 95.03</FONT>
<FONT FACE="DejaVu Sans Mono, monospace">Currency is : EURO</FONT></PRE><P STYLE="margin-bottom: 0in">
<FONT FACE="DejaVu Sans, sans-serif"><FONT SIZE=3>On client side, a
account report will be printed out after receiving stock quote result
from server:</FONT></FONT></P>
<PRE STYLE="margin-left: 0.79in">Account Report
==============
Stock Account peter2006_STA12345
Stock Symbol : IBM
Holding : 1000
Value : 76024.00

Checking Account peter2006_CHA12345
Balance : 1200.00

Savings Account peter2006_SAA12345
Balance : 2000.00</PRE><P STYLE="margin-bottom: 0in">
<A HREF="../../README.html">Back to the root page</A></P>
</BODY>
</HTML>
